function getlistlogin(use, password) {
    return new Promise(
        function (relsove, reject) {
            $.ajax(
                {
                    data: {
                        zhanghao: use,
                        password: password
                    },
                    url: `${baseUrl}/login`,
                    type: 'get',
                    success: (data) => {
                        if (data.code == 1000) {
                            alert('登陆成功')
                            location.href = './class.html?id=' + data.cls.id
                        } else {
                            alert('登陆失败')
                        }
                    }
                }
            )
        }
    )
}
function getaddlogin(obj) {
    return new Promise(function (resolve, reject) {
        $.post(`${baseUrl}/login`, obj, (data) => {
            resolve(data)
        })
    })
}

function getlistclass(id) {
    return new Promise(
        function (relsove, reject) {
            $.get(`${baseUrl}/class/${id}`, data => {
                relsove(data)
            })
        }
    )
}
function upclassblog(id, obj) {
    console.log(obj);
    return new Promise(function (resolve, reject) {
        $.ajax({
            url: `${baseUrl}/class/${id}`,
            data:obj,
            type: "put",
            success: function (data) {
                resolve(data)
            }
        })
        // $.ajax(
        //     {
        //         type: "put",
        //         url: `${baseUrl}/class/${id}`,
        //         data: obj,
        //         success:function(data){
        //          console.log(data);   

        //         }
        //     }
        // );
    })
}
function delclass(id) {
    return new Promise(function (resolve, reject) {
        $.ajax({
            url: `${baseUrl}/class/${id}`,
            type: "delete",
            success: function (data) {
                resolve(data)
            }
        })
    })
}
